package com.netbao.pro.vomapper;

import com.netbao.pro.model.WayBill;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;

import java.util.List;

public interface WayBillVoMapper {
//    @Select("SELECT * FROM pro_waybill WHERE eid=#{eid} AND cstatus!=2 ORDER BY opstatus ASC")
//    List<WayBill> list(long eid);
//    @Select("SELECT * FROM `pro_waybill` WHERE eid=#{eid} AND cstatus!=2 AND proname LIKE '%#{proName}%' ORDER BY opstatus ASC")
//    List<WayBill> like(long eid,String proName);

    @Delete("delete from pro_waybill_copy")
    void delete();

    @Insert("<script>INSERT INTO pro_waybill_copy(cno,idcard,stime,etime,eid,opid,proname,price,phone) VALUES\n" +
            "<foreach collection =\"list\" item=\"person\" separator =\",\">\n" +
            "\t(#{person.cno}, #{person.idcard}, #{person.birthday}, #{person.state})\n" +
            "</foreach></script>")
    void insertBatch(List<WayBill> wayBills);
    @Insert("INSERT INTO pro_waybill(cno,idcard,issigned,checktime,stime,etime,cstatus,eid,opid,opstatus,proname,price,phone)" +
            "values(f_prono(#{proid}),#{proid},#{idcard},#{issigned},#{checktime},#{stime},#{etime},#{cstatus},#{eid},#{opid},#{opstatus}" +
            ",#{proname},#{price},#{phone})")
    void add(Long proid, WayBill wayBill);
}
